Skip to content

OXY-165: Add LIKE / ILIKE predicate support to the oxygen-sql query DSL - #305

Merged
Kalin-Rudnicki merged 1 commit into
mainfrom
OXY-165
Aug 15, 2026
Merged

OXY-165: Add LIKE / ILIKE predicate support to the oxygen-sql query DSL#305
Kalin-Rudnicki merged 1 commit into
mainfrom
OXY-165

Conversation

@Kalin-Rudnicki

Copy link
Copy Markdown
Owner

OXY-165 — Add LIKE / ILIKE predicate support to the oxygen-sql query DSL

Adds LIKE / ILIKE (case-insensitive) string-pattern predicates — plus their negations — to the @compile query DSL, usable in where if ... on String columns. The pattern binds as a single scalar String param, so the generated SQL stays static (col LIKE ? / col ILIKE ?).

How it fits

Per the OXY-163 roadmap, the DSL's binary-operator extension points are generic. These slot in purely as new BinOp.Comp cases — the rest of the pipeline (RawQueryExpr, QueryExpr, FragmentBuilder) is generic over Comp, so no other production code changed. The query-var op input-var path already emits col <op> ? and binds the input using the LHS column's RowRepr.

DSL surface

On String columns:

  • col.like(pattern)col LIKE ?
  • col.ilike(pattern)col ILIKE ? (Postgres-specific)
  • col.notLike(pattern)col NOT LIKE ?
  • col.notILike(pattern)col NOT ILIKE ? (Postgres-specific)

Changes

  • BinOp.scala: 4 new Comp cases.
  • Q.scala: extension (self: String) methods.
  • it-test/queries.scala: 5 @compile queries.
  • it-test/CustomQuerySpec.scala: like / ilike integration test.
  • docs/docs/sql/queries.md: vocabulary row + dedicated section.

Testing

  • oxygen-sql/compile + sql-it/Test/compile succeed (the macro-expanded @compile queries compile, exercising the DSL + parser).
  • sql-it/testOnly oxygen.sql.CustomQuerySpec against real Postgres (testcontainers): 13/13 pass, including the new test covering %/_ wildcards, LIKE vs ILIKE case-sensitivity, NOT LIKE/NOT ILIKE, and && composition.
  • sbt fmt applied.

Notes

  • ILIKE / NOT ILIKE are Postgres-specific — acceptable while oxygen-sql is PG-only; flagged for the future Dialect seam.

🤖 Generated with Claude Code

https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6

Comment thread report/OXY-165.md Outdated
Add `like` / `ilike` / `notLike` / `notILike` string-pattern predicates,
usable in `where if ...` on String columns. The pattern binds as a single
scalar String param, so the generated SQL stays static (`col LIKE ?`).

These slot in as new `BinOp.Comp` cases; the rest of the pipeline
(RawQueryExpr / QueryExpr / FragmentBuilder) is generic over `Comp`, so no
other production code changes were needed.

- BinOp: LIKE / ILIKE / NOT LIKE / NOT ILIKE cases
- Q.scala: string extension methods
- it-test: @compile queries + real-Postgres CustomQuerySpec test
  (wildcards, case-sensitivity, negation, composition)
- docs/sql/queries.md

ILIKE / NOT ILIKE are Postgres-specific (fine while PG-only).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6
@Kalin-Rudnicki
Kalin-Rudnicki merged commit 99bf200 into main Aug 15, 2026
7 checks passed
@Kalin-Rudnicki
Kalin-Rudnicki deleted the OXY-165 branch August 15, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant